-
-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes for App Engine compatibility #1
Conversation
lidavidm
commented
Jun 28, 2013
- Do not use ctypes if not available
- Allow user to specify module when pickling
- Do not use ctypes if not available - Allow user to specify module when pickling
Changes:
|
Right now |
I'd say if passed a file-like object that it should never close it. That should be the job of the callee. |
Will also start to address this next week. |
import ctypes | ||
|
||
try: | ||
import __main__ as DEFAULT_MAIN_MODULE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be in a separate block. ctypes and __main__
are unrelated.
yep. I'm looking at that requested change now. |
I've added the HAS_CTYPES change, and that will post soon. There seem to be two central issues remaining:
@lidavidm: that's the gist of the remaining changes, right? Can you fill me in on sympy-live's requirement again for |
Regarding the close thing, I think the correct solution is if it's passed a file-like object, it should be the caller's responsibility to close it. |
It's because the App Engine doesn't define |
We've run into this issue with the standard library too. See http://bugs.python.org/issue16959 and https://code.google.com/p/googleappengine/issues/detail?id=8665. |
This is what In [24]: f = open('pickletest', 'bw')
In [25]: pickle.dump(1, f)
In [26]: f.closed
Out[26]: False |
I'll buy the change that if a file-like object is passed in, it's the caller's responsibility to close it. That'll go in. I think there's some work to do for cStringIO.StringIO, first however. I was pretty sure I remembered that the issue with @asmeurer: I don't get your example, however. In standard python, you get the same behavior:
On an aside, I did notice that |
What needs to be done?
Oh, sorry, I didn't realize that Anyway, I wouldn't take to heart too much the behavior of things in the SymPy Live shell, because it uses the pickling system that we are trying to get rid of with dill. The fact remains that if you import a library in the app engine that imports |
I guess dill uses |
Regarding |
What needs to be done with the file handler is to figure out how to deal with two things:
I remember the reasoning behind taking a file string name as an argument instead of a file handler. It's because if you do this:
You'd then be pickling the open file handler, unless you do something like popping |
Ok. I'll look into what App Engine is doing with main. I expect something like I mentioned earlier... but I'll have to have a look. |
Looks the daemon is So it seems like the same case I've seen in wx and ipython. As long as you can get a handle to it, I think there's a generic solution. Maybe let the caller be responsible for getting the handler, as a start... that'd put me close in line with David's code. |
Ahh, I didn't realize that the file object itself would be pickled because of this. Maybe dill just needs a |